import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    children: [
      { path: 'user', name: 'user', component: () => import('../views/user/User.vue') },
      { path: 'delete', name: 'delete', component: () => import('../views/script/DeleteScript.vue') },
      { path: 'invenyory', name: 'invenyory', component: () => import('../views/script/Inventory.vue') },
      { path: 'script', name: 'script', component: () => import('../views/script/Script.vue') },
      { path: 'allorder', name: 'allOrder', component: () => import('../views/group/allOrder.vue') },
      { path: 'backlog', name: 'backlog', component: () => import('../views/group/backlog.vue') },
      { path: 'overorder', name: 'overorder', component: () => import('../views/group/overOrder.vue') }
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
